package com.platform.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 退款申请
实体
 * 表名 t_order_drawback
 *
 * @author liweihai
 * @email liweihai12345@sina.com
 * @date 2019-04-24 18:03:19
 */
public class OrderDrawbackEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    //订单编号
    private String orderNo;
    //用户编号
    private Long uid;
    //手机号
    private String phone;
    //原因
    private String cause;
    //商品编号
    private Integer proId;
    //商品状态
    private Integer proStatus;
    //状态名称
    private String proStatusName;
    //金额
    private BigDecimal amount;
    //退款金额
    private BigDecimal backAmount;
    //说明
    private String explain;

    private List<String> certificates;

    private String certificateReceive;
    //凭证
    private String certificate;
    //状态1申请中2通过3完成
    private Integer statu;
    //类型
    private Integer type;
    //创建时间
    private Date createDate;
    //修改时间
    private Date updateDate;

    /**
     * 设置：订单编号
     */
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    /**
     * 获取：订单编号
     */
    public String getOrderNo() {
        return orderNo;
    }
    /**
     * 设置：用户编号
     */
    public void setUid(Long uid) {
        this.uid = uid;
    }

    /**
     * 获取：用户编号
     */
    public Long getUid() {
        return uid;
    }
    /**
     * 设置：手机号
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * 获取：手机号
     */
    public String getPhone() {
        return phone;
    }
    /**
     * 设置：原因
     */
    public void setCause(String cause) {
        this.cause = cause;
    }

    /**
     * 获取：原因
     */
    public String getCause() {
        return cause;
    }
    /**
     * 设置：商品编号
     */
    public void setProId(Integer proId) {
        this.proId = proId;
    }

    /**
     * 获取：商品编号
     */
    public Integer getProId() {
        return proId;
    }
    /**
     * 设置：商品状态
     */
    public void setProStatus(Integer proStatus) {
        this.proStatus = proStatus;
    }

    /**
     * 获取：商品状态
     */
    public Integer getProStatus() {
        return proStatus;
    }
    /**
     * 设置：状态名称
     */
    public void setProStatusName(String proStatusName) {
        this.proStatusName = proStatusName;
    }

    /**
     * 获取：状态名称
     */
    public String getProStatusName() {
        return proStatusName;
    }
    /**
     * 设置：金额
     */
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * 获取：金额
     */
    public BigDecimal getAmount() {
        return amount;
    }
    /**
     * 设置：退款金额
     */
    public void setBackAmount(BigDecimal backAmount) {
        this.backAmount = backAmount;
    }

    /**
     * 获取：退款金额
     */
    public BigDecimal getBackAmount() {
        return backAmount;
    }
    /**
     * 设置：说明
     */
    public void setExplain(String explain) {
        this.explain = explain;
    }

    /**
     * 获取：说明
     */
    public String getExplain() {
        return explain;
    }
    /**
     * 设置：凭证
     */
    public void setCertificate(String certificate) {
        this.certificate = certificate;
    }

    /**
     * 获取：凭证
     */
    public String getCertificate() {
        return certificate;
    }
    /**
     * 设置：状态1申请中2通过3完成
     */
    public void setStatu(Integer statu) {
        this.statu = statu;
    }

    /**
     * 获取：状态1申请中2通过3完成
     */
    public Integer getStatu() {
        return statu;
    }
    /**
     * 设置：类型
     */
    public void setType(Integer type) {
        this.type = type;
    }

    /**
     * 获取：类型
     */
    public Integer getType() {
        return type;
    }
    /**
     * 设置：创建时间
     */
    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    /**
     * 获取：创建时间
     */
    public Date getCreateDate() {
        return createDate;
    }
    /**
     * 设置：修改时间
     */
    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    /**
     * 获取：修改时间
     */
    public Date getUpdateDate() {
        return updateDate;
    }

    public List<String> getCertificates(){
        List<String> strings = new ArrayList<>();
        if(this.certificate.contains(",")){
            String[] split = this.certificate.split(",");
            strings = Arrays.asList(split);
            return strings;
        }
        strings.add(this.certificate);
        return strings;
    }
    public void setCertificates(List<String> certificates){
        this.certificates = certificates;
    }

    public String getCertificateReceive(){
        if(certificates != null && certificates.size()>0){
            Collections.sort(certificates);
            return certificates.stream().collect(Collectors.joining(","));
        }
        return null;
    }
}
